import 'dart:async';
import 'dart:ui';

import 'package:flutter/material.dart';
import 'package:flutter_base_app/widgets/ball/frame_call_back_manager.dart';
import 'package:flutter_screenutil/flutter_screenutil.dart';

import 'demo/test_page.dart';

void main() {
  runZonedGuarded(() async {
    WidgetsFlutterBinding.ensureInitialized();
    FlutterError.onError = (flutterErrorDetails) {
      print('app error recordFlutterFatalError ${flutterErrorDetails.exception} \n ${flutterErrorDetails.stack?.toString()}');
    };
    PlatformDispatcher.instance.onError = (error, stack) {
      print('app error recordError ${error.toString()} \n ${stack.toString()}');
      return true;
    };
    runApp(const MyApp());
    FrameCallBackManager.get().init();
  }, (error, stackTrace) {
    print('app error ${error.toString()} \n ${stackTrace.toString()}');
    // 在这里处理未捕获的异常
  });
}

class MyApp extends StatelessWidget {
  const MyApp({super.key});

  @override
  Widget build(BuildContext context) {
    return const ScreenUtilInit(
      designSize: Size(375, 812),
      child: MaterialApp(
        title: 'Flutter Demo',
        home: TestPage(),
      ),
    );
  }
}

